from problems import parse_problem
import graphic_problems_2
from astar_solution import astar_solution
from heuristics import  manhattan_dirt
import matplotlib.pyplot as plt
from numpy import arange

problems = {}
values = []


for (k,p) in graphic_problems_2.p.items():
    p_ = parse_problem(p)
    t,s=astar_solution(manhattan_dirt()).solve(p_)
    problems[t*s] = k
    values.append(t*s)

values.sort()
print values
print problems

width = 0.15  
bars={}
indexes = []

ax = plt.subplot(111)

i = 0
for v in values:
    bars[t]= plt.bar(i, v, width)
    i += 1
    indexes.append(problems[v])
ind = arange(len(values))
ax.set_xticks(ind+width)
ax.set_xticklabels(indexes)

plt.show()
